Skip to content

🦈 IMP: LLVM 20, Minor Assembly Optimizations, MantaRay 2, Python Bindings#45

Merged
TheBlackPlague merged 184 commits intomasterfrom
cpp23-clang20
May 13, 2025
Merged

🦈 IMP: LLVM 20, Minor Assembly Optimizations, MantaRay 2, Python Bindings#45
TheBlackPlague merged 184 commits intomasterfrom
cpp23-clang20

Conversation

@TheBlackPlague
Copy link
Owner

@TheBlackPlague TheBlackPlague commented Apr 1, 2025

🎯 Summary

This PR does the following:

  • Upgrade to C++23. Furthermore, specific style changes are made to ensure modern-day code with respect to LLVM 20.
  • Upgrade to LLVM 20 concerning action workflows and documentation, as it provides better support for C++23.
  • Upgrade to MantaRay 2 (currently under development).
  • MantaRay 2 relying on CMake V3.21 requires StockDory's minimum CMake version to increase to 3.21.
  • Removes redundant zeroing stack operations that can be avoided when allocating the move list.
  • Removes inline decorative from most places and resolves to rely on compiler inlining choices. In some instances, guaranteed inlining is still wanted, and in those situations, [[clang::always_inline]] is used.
  • Switch to Nanothread for the backing Thread Pool Library and encapsulate it in a C++ Thread Pool class.

All of the above lead to considerable performance improvements.

In addition, StockDory now provides Python Bindings as an ease-of-use addition. These Python Bindings are largely unfinished in their current state and will be subject to change until engine version 1.0, but they should help those interested in using the engine from Python. Performance issues will be monitored.

As a side note, workflows are refactored into more modern versions and support mainstream Apple Desktop chips.

👏 Acknowledgements

NA

📈 ELO

STC:

Elo   | 6.01 +- 4.18 (95%)
SPRT  | 10.0+0.10s Threads=1 Hash=16MB
LLR   | 2.95 (-2.94, 2.94) [0.00, 5.00]
Games | N: 9304 W: 2474 L: 2313 D: 4517
Penta | [119, 1058, 2155, 1183, 137]

LTC:

Elo   | 9.90 +- 5.45 (95%)
SPRT  | 60.0+0.60s Threads=1 Hash=128MB
LLR   | 2.96 (-2.94, 2.94) [0.00, 5.00]
Games | N: 4494 W: 1117 L: 989 D: 2388
Penta | [24, 482, 1114, 596, 31]

- Update Thread Pool
- Fix UCI errors
- Remove duplicate code in entry fx.
UCI options should be updated in my opinion to reflect a minimum thread count of 2 (UCI Input Thread + Search Thread).
Apparently the compiler was zero initializing the score. Bad compiler.

Bench: 7025779
In other cases, use [[clang::always_inline]] and [[clang::no_inline]].

Bench: 7025779
@TheBlackPlague TheBlackPlague requested a review from Copilot May 8, 2025 19:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the codebase to support Python bindings while upgrading the LLVM requirement to version 20. Key changes include refactoring the AttackTable namespace and static data definitions, modernizing the Board class implementation with newer C++ features and improved castling logic, and updating build scripts and CI workflows for better cross‐platform support and PGO builds.

Reviewed Changes

Copilot reviewed 55 out of 65 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Backend/Move/AttackTable.h Refactored namespace and removed unused includes and code sections.
src/Backend/Misc.h Added a utility function for hexadecimal conversion.
src/Backend/Board.h Modernized constructors and methods, updated castling and move logic.
pyproject.toml Introduced configuration for Python bindings using Pybind11.
README.md Updated LLVM version requirement and minor documentation tweaks.
Makefile Enhanced build targets with improved profiling and cross-platform flags.
Information.cmake Updated author string for consistency.
CMakeLists.txt Revised C++ standard and options to support Python module building.
.github/workflows/*.yml Updated workflows to use Clang 20 and expanded build matrix configurations.
Files not reviewed (10)
  • .idea/.name: Language not supported
  • .idea/codeStyles/Project.xml: Language not supported
  • .idea/codeStyles/codeStyleConfig.xml: Language not supported
  • .idea/deployment.xml: Language not supported
  • .idea/editor.xml: Language not supported
  • .idea/fileTemplates/internal/C Header File.h: Language not supported
  • .idea/fileTemplates/internal/C++ Class Header.h: Language not supported
  • .idea/inspectionProfiles/Project_Default.xml: Language not supported
  • .idea/misc.xml: Language not supported
  • .idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (1)

src/Backend/Board.h:128

  • [nitpick] The debug output to std::cout may be inappropriate in production; consider removing it or replacing it with a proper error logging mechanism or assertion.
if (piece == NAP) std::cout << "ERROR" << std::endl;

@TheBlackPlague TheBlackPlague changed the title 🦈 IMP: Python Bindings and LLVM 20 🦈 IMP: LLVM 20, Minor Assembly Optimizations, MantaRay 2, Python Bindings May 8, 2025
@TheBlackPlague TheBlackPlague added + ELO This change gains ELO. = DOC This change doesn't improve the documentation. + DOC This change improves the documentation. and removed = DOC This change doesn't improve the documentation. labels May 10, 2025
@TheBlackPlague TheBlackPlague marked this pull request as ready for review May 10, 2025 01:47
@TheBlackPlague TheBlackPlague merged commit e691d35 into master May 13, 2025
3 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

+ DOC This change improves the documentation. + ELO This change gains ELO.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants